<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qquicktextedit.cpp -->
  <title>TextEdit QML 类型 | Qt Quick 5.12.3</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.12</a></td><td ><a href="qtquick-index.html">Qt Quick 模块</a></td><td ><a href="qtquick-qmlmodule.html">QML类型</a></td><td >TextEdit QML 类型</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtquick-index.html">Qt 5.12.3 参考指南</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">目录</a></h3>
<ul>
<li class="level1"><a href="#properties">属性</a></li>
<li class="level1"><a href="#signals">信号</a></li>
<li class="level1"><a href="#methods">Methods</a></li>
<li class="level1"><a href="#details">详细信息</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">TextEdit QML 类型</h1>
<span class="subtitle"></span>
<!-- $$$TextEdit-brief -->
<p>Displays multiple lines of editable formatted text. <a href="#details">更多...</a></p>
<!-- @@@TextEdit -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> 导入语句：</td><td class="memItemRight bottomAlign"> import QtQuick 2.12</td></tr><tr><td class="memItemLeft rightAlign topAlign">继承自：</td><td class="memItemRight bottomAlign"> <p><a href="qml-qtquick-item.html">Item</a></p>
</td></tr></table></div><ul>
<li><a href="qml-qtquick-textedit-members.html">所有成员的列表，包括继承成员</a></li>
</ul>
<a name="properties"></a>
<h2 id="properties">属性</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#activeFocusOnPress-prop">activeFocusOnPress</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#baseUrl-prop">baseUrl</a></b></b> : url</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#bottomPadding-prop">bottomPadding</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#canPaste-prop">canPaste</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#canRedo-prop">canRedo</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#canUndo-prop">canUndo</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#color-prop">color</a></b></b> : color</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#contentHeight-prop">contentHeight</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#contentWidth-prop">contentWidth</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#cursorDelegate-prop">cursorDelegate</a></b></b> : Component</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#cursorPosition-prop">cursorPosition</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#cursorRectangle-prop">cursorRectangle</a></b></b> : rectangle</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#cursorVisible-prop">cursorVisible</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#effectiveHorizontalAlignment-prop">effectiveHorizontalAlignment</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#font.bold-prop">font.bold</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#font.capitalization-prop">font.capitalization</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#font.family-prop">font.family</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#font.hintingPreference-prop">font.hintingPreference</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#font.italic-prop">font.italic</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#font.kerning-prop">font.kerning</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#font.letterSpacing-prop">font.letterSpacing</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#font.pixelSize-prop">font.pixelSize</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#font.pointSize-prop">font.pointSize</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#font.preferShaping-prop">font.preferShaping</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#font.strikeout-prop">font.strikeout</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#font.styleName-prop">font.styleName</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#font.underline-prop">font.underline</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#font.weight-prop">font.weight</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#font.wordSpacing-prop">font.wordSpacing</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#horizontalAlignment-prop">horizontalAlignment</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#hoveredLink-prop">hoveredLink</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#inputMethodComposing-prop">inputMethodComposing</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#inputMethodHints-prop">inputMethodHints</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#leftPadding-prop">leftPadding</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#length-prop">length</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#lineCount-prop">lineCount</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#mouseSelectionMode-prop">mouseSelectionMode</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#overwriteMode-prop">overwriteMode</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#padding-prop">padding</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#persistentSelection-prop">persistentSelection</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#preeditText-prop">preeditText</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#readOnly-prop">readOnly</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#renderType-prop">renderType</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#rightPadding-prop">rightPadding</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#selectByKeyboard-prop">selectByKeyboard</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#selectByMouse-prop">selectByMouse</a></b></b> : bool</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#selectedText-prop">selectedText</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#selectedTextColor-prop">selectedTextColor</a></b></b> : color</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#selectionColor-prop">selectionColor</a></b></b> : color</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#selectionEnd-prop">selectionEnd</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#selectionStart-prop">selectionStart</a></b></b> : int</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#tabStopDistance-prop">tabStopDistance</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#text-prop">text</a></b></b> : string</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#textDocument-prop">textDocument</a></b></b> : TextDocument</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#textFormat-prop">textFormat</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#textMargin-prop">textMargin</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#topPadding-prop">topPadding</a></b></b> : real</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#verticalAlignment-prop">verticalAlignment</a></b></b> : enumeration</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#wrapMode-prop">wrapMode</a></b></b> : enumeration</li>
</ul>
<a name="signals"></a>
<h2 id="signals">信号</h2>
<ul>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#editingFinished-signal">editingFinished</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#linkActivated-signal">linkActivated</a></b></b>(string <i>link</i>)</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#linkHovered-signal">linkHovered</a></b></b>(string <i>link</i>)</li>
</ul>
<a name="methods"></a>
<h2 id="methods">Methods</h2>
<ul>
<li class="fn">void <b><b><a href="qml-qtquick-textedit.html#append-method">append</a></b></b>(string <i>text</i>)</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#clear-method">clear</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#copy-method">copy</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#cut-method">cut</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#deselect-method">deselect</a></b></b>()</li>
<li class="fn">string <b><b><a href="qml-qtquick-textedit.html#getFormattedText-method">getFormattedText</a></b></b>(int <i>start</i>,  int <i>end</i>)</li>
<li class="fn">string <b><b><a href="qml-qtquick-textedit.html#getText-method">getText</a></b></b>(int <i>start</i>,  int <i>end</i>)</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#insert-method">insert</a></b></b>(int <i>position</i>,  string <i>text</i>)</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#isRightToLeft-method">isRightToLeft</a></b></b>(int <i>start</i>,  int <i>end</i>)</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#linkAt-method">linkAt</a></b></b>(real <i>x</i>,  real <i>y</i>)</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#moveCursorSelection-method">moveCursorSelection</a></b></b>(int <i>position</i>,  SelectionMode mode = <i>TextEdit.SelectCharacters</i>)</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#paste-method">paste</a></b></b>()</li>
<li class="fn">int <b><b><a href="qml-qtquick-textedit.html#positionAt-method">positionAt</a></b></b>(int <i>x</i>,  int <i>y</i>)</li>
<li class="fn">rectangle <b><b><a href="qml-qtquick-textedit.html#positionToRectangle-method">positionToRectangle</a></b></b>(<i>position</i>)</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#redo-method">redo</a></b></b>()</li>
<li class="fn">string <b><b><a href="qml-qtquick-textedit.html#remove-method">remove</a></b></b>(int <i>start</i>,  int <i>end</i>)</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#select-method">select</a></b></b>(int <i>start</i>,  int <i>end</i>)</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#selectAll-method">selectAll</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#selectWord-method">selectWord</a></b></b>()</li>
<li class="fn"><b><b><a href="qml-qtquick-textedit.html#undo-method">undo</a></b></b>()</li>
</ul>
<!-- $$$TextEdit-description -->
<a name="details"></a>
<h2 id="details">详细信息</h2>
<p>The <a href="qml-qtquick-textedit.html">TextEdit</a> item displays a block of editable, formatted text.</p>
<p>It can display both plain and rich text. For example:</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-textedit.html">TextEdit</a></span> {
      <span class="name">width</span>: <span class="number">240</span>
      <span class="name">text</span>: <span class="string">&quot;&lt;b&gt;Hello&lt;/b&gt; &lt;i&gt;World!&lt;/i&gt;&quot;</span>
      <span class="name">font</span>.family: <span class="string">&quot;Helvetica&quot;</span>
      <span class="name">font</span>.pointSize: <span class="number">20</span>
      <span class="name">color</span>: <span class="string">&quot;blue&quot;</span>
      <span class="name">focus</span>: <span class="number">true</span>
  }

</pre>
<p class="centerAlign"><img src="images/declarative-textedit.gif" alt="" /></p><p>Setting <a href="qml-qtquick-item.html#focus-prop">focus</a> to <code>true</code> enables the <a href="qml-qtquick-textedit.html">TextEdit</a> item to receive keyboard focus.</p>
<p>Note that the <a href="qml-qtquick-textedit.html">TextEdit</a> does not implement scrolling, following the cursor, or other behaviors specific to a look-and-feel. For example, to add flickable scrolling that follows the cursor:</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-flickable.html">Flickable</a></span> {
       <span class="name">id</span>: <span class="name">flick</span>

       <span class="name">width</span>: <span class="number">300</span>; <span class="name">height</span>: <span class="number">200</span>;
       <span class="name">contentWidth</span>: <span class="name">edit</span>.<span class="name">paintedWidth</span>
       <span class="name">contentHeight</span>: <span class="name">edit</span>.<span class="name">paintedHeight</span>
       <span class="name">clip</span>: <span class="number">true</span>

       <span class="keyword">function</span> <span class="name">ensureVisible</span>(r)
       {
           <span class="keyword">if</span> (<span class="name">contentX</span> <span class="operator">&gt;=</span> <span class="name">r</span>.<span class="name">x</span>)
               <span class="name">contentX</span> <span class="operator">=</span> <span class="name">r</span>.<span class="name">x</span>;
           <span class="keyword">else</span> <span class="keyword">if</span> (<span class="name">contentX</span><span class="operator">+</span><span class="name">width</span> <span class="operator">&lt;=</span> <span class="name">r</span>.<span class="name">x</span><span class="operator">+</span><span class="name">r</span>.<span class="name">width</span>)
               <span class="name">contentX</span> <span class="operator">=</span> <span class="name">r</span>.<span class="name">x</span><span class="operator">+</span><span class="name">r</span>.<span class="name">width</span><span class="operator">-</span><span class="name">width</span>;
           <span class="keyword">if</span> (<span class="name">contentY</span> <span class="operator">&gt;=</span> <span class="name">r</span>.<span class="name">y</span>)
               <span class="name">contentY</span> <span class="operator">=</span> <span class="name">r</span>.<span class="name">y</span>;
           <span class="keyword">else</span> <span class="keyword">if</span> (<span class="name">contentY</span><span class="operator">+</span><span class="name">height</span> <span class="operator">&lt;=</span> <span class="name">r</span>.<span class="name">y</span><span class="operator">+</span><span class="name">r</span>.<span class="name">height</span>)
               <span class="name">contentY</span> <span class="operator">=</span> <span class="name">r</span>.<span class="name">y</span><span class="operator">+</span><span class="name">r</span>.<span class="name">height</span><span class="operator">-</span><span class="name">height</span>;
       }

       <span class="type"><a href="qml-qtquick-textedit.html">TextEdit</a></span> {
           <span class="name">id</span>: <span class="name">edit</span>
           <span class="name">width</span>: <span class="name">flick</span>.<span class="name">width</span>
           <span class="name">focus</span>: <span class="number">true</span>
           <span class="name">wrapMode</span>: <span class="name">TextEdit</span>.<span class="name">Wrap</span>
           <span class="name">onCursorRectangleChanged</span>: <span class="name">flick</span>.<span class="name">ensureVisible</span>(<span class="name">cursorRectangle</span>)
       }
   }

</pre>
<p>A particular look-and-feel might use smooth scrolling (eg. using <a href="qml-qtquick-smoothedanimation.html">SmoothedAnimation</a>), might have a visible scrollbar, or a scrollbar that fades in to show location, etc.</p>
<p>Clipboard support is provided by the <a href="qml-qtquick-textedit.html#cut-method">cut()</a>, <a href="qml-qtquick-textedit.html#copy-method">copy()</a>, and <a href="qml-qtquick-textedit.html#paste-method">paste()</a> functions, and the selection can be handled in a traditional &quot;mouse&quot; mechanism by setting <a href="qml-qtquick-textedit.html#selectByMouse-prop">selectByMouse</a>, or handled completely from QML by manipulating <a href="qml-qtquick-textedit.html#selectionStart-prop">selectionStart</a> and <a href="qml-qtquick-textedit.html#selectionEnd-prop">selectionEnd</a>, or using <a href="qml-qtquick-textedit.html#selectAll-method">selectAll()</a> or <a href="qml-qtquick-textedit.html#selectWord-method">selectWord()</a>.</p>
<p>You can translate between cursor positions (characters from the start of the document) and pixel points using <a href="qml-qtquick-textedit.html#positionAt-method">positionAt()</a> and <a href="qml-qtquick-textedit.html#positionToRectangle-method">positionToRectangle()</a>.</p>
<p><b>请参考 </b><a href="qml-qtquick-text.html">Text</a> 和 <a href="qml-qtquick-textinput.html">TextInput</a>。</p>
<!-- @@@TextEdit -->
<h2>属性文档</h2>
<!-- $$$activeFocusOnPress -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="activeFocusOnPress-prop">
<td class="tblQmlPropNode"><p>
<a name="activeFocusOnPress-prop"></a><span class="name">activeFocusOnPress</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Whether the <a href="qml-qtquick-textedit.html">TextEdit</a> should gain active focus on a mouse press. By default this is set to true.</p>
</div></div><!-- @@@activeFocusOnPress -->
<br/>
<!-- $$$baseUrl -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="baseUrl-prop">
<td class="tblQmlPropNode"><p>
<a name="baseUrl-prop"></a><span class="name">baseUrl</span> : <span class="type"><a href="../qtqml/qml-url.html">url</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property specifies a base URL which is used to resolve relative URLs within the text.</p>
<p>The default value is the url of the QML file instantiating the <a href="qml-qtquick-textedit.html">TextEdit</a> item.</p>
</div></div><!-- @@@baseUrl -->
<br/>
<!-- $$$bottomPadding -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="bottomPadding-prop">
<td class="tblQmlPropNode"><p>
<a name="bottomPadding-prop"></a><span class="name">bottomPadding</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>These properties hold the padding around the content. This space is reserved in addition to the <a href="qml-qtquick-textedit.html#contentWidth-prop">contentWidth</a> and <a href="qml-qtquick-textedit.html#contentHeight-prop">contentHeight</a>.</p>
<p>This property was introduced in  Qt 5.6.</p>
</div></div><!-- @@@bottomPadding -->
<br/>
<!-- $$$canPaste -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="canPaste-prop">
<td class="tblQmlPropNode"><p>
<a name="canPaste-prop"></a><span class="name">canPaste</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Returns true if the <a href="qml-qtquick-textedit.html">TextEdit</a> is writable and the content of the clipboard is suitable for pasting into the <a href="qml-qtquick-textedit.html">TextEdit</a>.</p>
</div></div><!-- @@@canPaste -->
<br/>
<!-- $$$canRedo -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="canRedo-prop">
<td class="tblQmlPropNode"><p>
<a name="canRedo-prop"></a><span class="name">canRedo</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Returns true if the <a href="qml-qtquick-textedit.html">TextEdit</a> is writable and there are <a href="qml-qtquick-textedit.html#undo-method">undone</a> operations that can be redone.</p>
</div></div><!-- @@@canRedo -->
<br/>
<!-- $$$canUndo -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="canUndo-prop">
<td class="tblQmlPropNode"><p>
<a name="canUndo-prop"></a><span class="name">canUndo</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Returns true if the <a href="qml-qtquick-textedit.html">TextEdit</a> is writable and there are previous operations that can be undone.</p>
</div></div><!-- @@@canUndo -->
<br/>
<!-- $$$color -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="color-prop">
<td class="tblQmlPropNode"><p>
<a name="color-prop"></a><span class="name">color</span> : <span class="type"><a href="qml-color.html">color</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The text color.</p>
<pre class="qml">

  <span class="comment">// green text using hexadecimal notation</span>
  <span class="type"><a href="qml-qtquick-textedit.html">TextEdit</a></span> { <span class="name">color</span>: <span class="string">&quot;#00FF00&quot;</span> }

</pre>
<pre class="qml">

  <span class="comment">// steelblue text using SVG color name</span>
  <span class="type"><a href="qml-qtquick-textedit.html">TextEdit</a></span> { <span class="name">color</span>: <span class="string">&quot;steelblue&quot;</span> }

</pre>
</div></div><!-- @@@color -->
<br/>
<!-- $$$contentHeight -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="contentHeight-prop">
<td class="tblQmlPropNode"><p>
<a name="contentHeight-prop"></a><span class="name">contentHeight</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Returns the height of the text, including the height past the height that is covered if the text does not fit within the set height.</p>
</div></div><!-- @@@contentHeight -->
<br/>
<!-- $$$contentWidth -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="contentWidth-prop">
<td class="tblQmlPropNode"><p>
<a name="contentWidth-prop"></a><span class="name">contentWidth</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Returns the width of the text, including the width past the width which is covered due to insufficient wrapping if <a href="qml-qtquick-textedit.html#wrapMode-prop">wrapMode</a> is set.</p>
</div></div><!-- @@@contentWidth -->
<br/>
<!-- $$$cursorDelegate -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="cursorDelegate-prop">
<td class="tblQmlPropNode"><p>
<a name="cursorDelegate-prop"></a><span class="name">cursorDelegate</span> : <span class="type"><a href="../qtqml/qml-qtqml-component.html">Component</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The delegate for the cursor in the <a href="qml-qtquick-textedit.html">TextEdit</a>.</p>
<p>If you set a cursorDelegate for a <a href="qml-qtquick-textedit.html">TextEdit</a>, this delegate will be used for drawing the cursor instead of the standard cursor. An instance of the delegate will be created and managed by the text edit when a cursor is needed, and the x and y properties of delegate instance will be set so as to be one pixel before the top left of the current character.</p>
<p>Note that the root item of the delegate component must be a <a href="qquickitem.html">QQuickItem</a> or <a href="qquickitem.html">QQuickItem</a> derived item.</p>
</div></div><!-- @@@cursorDelegate -->
<br/>
<!-- $$$cursorPosition -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="cursorPosition-prop">
<td class="tblQmlPropNode"><p>
<a name="cursorPosition-prop"></a><span class="name">cursorPosition</span> : <span class="type"><a href="../qtqml/qml-int.html">int</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The position of the cursor in the <a href="qml-qtquick-textedit.html">TextEdit</a>.</p>
</div></div><!-- @@@cursorPosition -->
<br/>
<!-- $$$cursorRectangle -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="cursorRectangle-prop">
<td class="tblQmlPropNode"><p>
<a name="cursorRectangle-prop"></a><span class="name">cursorRectangle</span> : <span class="type">rectangle</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The rectangle where the standard text cursor is rendered within the text edit. Read-only.</p>
<p>The position and height of a custom <a href="qml-qtquick-textedit.html#cursorDelegate-prop">cursorDelegate</a> are updated to follow the cursorRectangle automatically when it changes. The width of the delegate is unaffected by changes in the cursor rectangle.</p>
</div></div><!-- @@@cursorRectangle -->
<br/>
<!-- $$$cursorVisible -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="cursorVisible-prop">
<td class="tblQmlPropNode"><p>
<a name="cursorVisible-prop"></a><span class="name">cursorVisible</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>If true the text edit shows a cursor.</p>
<p>This property is set and unset when the text edit gets active focus, but it can also be set directly (useful, for example, if a KeyProxy might forward keys to it).</p>
</div></div><!-- @@@cursorVisible -->
<br/>
<!-- $$$effectiveHorizontalAlignment -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="effectiveHorizontalAlignment-prop">
<td class="tblQmlPropNode"><p>
<a name="effectiveHorizontalAlignment-prop"></a><span class="name">effectiveHorizontalAlignment</span> : <span class="type"><a href="../qtqml/qml-enumeration.html">enumeration</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Sets the horizontal and vertical alignment of the text within the <a href="qml-qtquick-textedit.html">TextEdit</a> item's width and height. By default, the text alignment follows the natural alignment of the text, for example text that is read from left to right will be aligned to the left.</p>
<p>Valid values for <code>horizontalAlignment</code> are:</p>
<ul>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.AlignLeft (default)</li>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.AlignRight</li>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.AlignHCenter</li>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.AlignJustify</li>
</ul>
<p>Valid values for <code>verticalAlignment</code> are:</p>
<ul>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.AlignTop (default)</li>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.AlignBottom</li>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.AlignVCenter</li>
</ul>
<p>When using the attached property <a href="qml-qtquick-layoutmirroring.html#enabled-prop">LayoutMirroring::enabled</a> to mirror application layouts, the horizontal alignment of text will also be mirrored. However, the property <code>horizontalAlignment</code> will remain unchanged. To query the effective horizontal alignment of <a href="qml-qtquick-textedit.html">TextEdit</a>, use the read-only property <code>effectiveHorizontalAlignment</code>.</p>
</div></div><!-- @@@effectiveHorizontalAlignment -->
<br/>
<!-- $$$font.bold -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="font.bold-prop">
<td class="tblQmlPropNode"><p>
<a name="font.bold-prop"></a><span class="name">font.bold</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Sets whether the font weight is bold.</p>
</div></div><!-- @@@font.bold -->
<br/>
<!-- $$$font.capitalization -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="font.capitalization-prop">
<td class="tblQmlPropNode"><p>
<a name="font.capitalization-prop"></a><span class="name">font.capitalization</span> : <span class="type"><a href="../qtqml/qml-enumeration.html">enumeration</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Sets the capitalization for the text.</p>
<ul>
<li>Font.MixedCase - This is the normal text rendering option where no capitalization change is applied.</li>
<li>Font.AllUppercase - This alters the text to be rendered in all uppercase type.</li>
<li>Font.AllLowercase - This alters the text to be rendered in all lowercase type.</li>
<li>Font.SmallCaps - This alters the text to be rendered in small-caps type.</li>
<li>Font.Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character.</li>
</ul>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-textedit.html">TextEdit</a></span> { <span class="name">text</span>: <span class="string">&quot;Hello&quot;</span>; <span class="name">font</span>.capitalization: <span class="name">Font</span>.<span class="name">AllLowercase</span> }

</pre>
</div></div><!-- @@@font.capitalization -->
<br/>
<!-- $$$font.family -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="font.family-prop">
<td class="tblQmlPropNode"><p>
<a name="font.family-prop"></a><span class="name">font.family</span> : <span class="type"><a href="../qtqml/qml-string.html">string</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Sets the family name of the font.</p>
<p>The family name is case insensitive and may optionally include a foundry name, e.g&#x2e; &quot;Helvetica [Cronyx]&quot;. If the family is available from more than one foundry and the foundry isn't specified, an arbitrary foundry is chosen. If the family isn't available a family will be set using the font matching algorithm.</p>
</div></div><!-- @@@font.family -->
<br/>
<!-- $$$font.hintingPreference -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="font.hintingPreference-prop">
<td class="tblQmlPropNode"><p>
<a name="font.hintingPreference-prop"></a><span class="name">font.hintingPreference</span> : <span class="type"><a href="../qtqml/qml-enumeration.html">enumeration</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Sets the preferred hinting on the text. This is a hint to the underlying text rendering system to use a certain level of hinting, and has varying support across platforms. See the table in the documentation for <a href="../qtgui/qfont.html#HintingPreference-enum">QFont::HintingPreference</a> for more details.</p>
<p><b>Note: </b>This property only has an effect when used together with render type <a href="qml-qtquick-textedit.html">TextEdit</a>.NativeRendering.</p></td></tr>
<p>Font.PreferDefaultHinting - Use the default hinting level for the target platform.</p>
</td></tr>
<p>Font.PreferNoHinting - If possible, render text without hinting the outlines of the glyphs. The text layout will be typographically accurate, using the same metrics as are used e.g&#x2e; when printing.</p>
</td></tr>
<p>Font.PreferVerticalHinting - If possible, render text with no horizontal hinting, but align glyphs to the pixel grid in the vertical direction. The text will appear crisper on displays where the density is too low to give an accurate rendering of the glyphs. But since the horizontal metrics of the glyphs are unhinted, the text's layout will be scalable to higher density devices (such as printers) without impacting details such as line breaks.</p>
</td></tr>
<p>Font.PreferFullHinting - If possible, render text with hinting in both horizontal and vertical directions. The text will be altered to optimize legibility on the target device, but since the metrics will depend on the target size of the text, the positions of glyphs, line breaks, and other typographical detail will not scale, meaning that a text layout may look different on devices with different pixel densities.</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-textedit.html">TextEdit</a></span> { <span class="name">text</span>: <span class="string">&quot;Hello&quot;</span>; <span class="name">renderType</span>: <span class="name">TextEdit</span>.<span class="name">NativeRendering</span>; <span class="name">font</span>.hintingPreference: <span class="name">Font</span>.<span class="name">PreferVerticalHinting</span> }

</pre>
<p>This property was introduced in  Qt 5.8.</p>
</div></div><!-- @@@font.hintingPreference -->
<br/>
<!-- $$$font.italic -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="font.italic-prop">
<td class="tblQmlPropNode"><p>
<a name="font.italic-prop"></a><span class="name">font.italic</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Sets whether the font has an italic style.</p>
</div></div><!-- @@@font.italic -->
<br/>
<!-- $$$font.kerning -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="font.kerning-prop">
<td class="tblQmlPropNode"><p>
<a name="font.kerning-prop"></a><span class="name">font.kerning</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Enables or disables the kerning OpenType feature when shaping the text. Disabling this may improve performance when creating or changing the text, at the expense of some cosmetic features. The default value is true.</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-textedit.html">TextEdit</a></span> { <span class="name">text</span>: <span class="string">&quot;OATS FLAVOUR WAY&quot;</span>; <span class="name">kerning</span>: <span class="name">font</span>.<span class="name">false</span> }

</pre>
<p>This property was introduced in  Qt 5.10.</p>
</div></div><!-- @@@font.kerning -->
<br/>
<!-- $$$font.letterSpacing -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="font.letterSpacing-prop">
<td class="tblQmlPropNode"><p>
<a name="font.letterSpacing-prop"></a><span class="name">font.letterSpacing</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Sets the letter spacing for the font.</p>
<p>Letter spacing changes the default spacing between individual letters in the font. A positive value increases the letter spacing by the corresponding pixels; a negative value decreases the spacing.</p>
</div></div><!-- @@@font.letterSpacing -->
<br/>
<!-- $$$font.pixelSize -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="font.pixelSize-prop">
<td class="tblQmlPropNode"><p>
<a name="font.pixelSize-prop"></a><span class="name">font.pixelSize</span> : <span class="type"><a href="../qtqml/qml-int.html">int</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Sets the font size in pixels.</p>
<p>Using this function makes the font device dependent. Use <a href="qml-qtquick-textedit.html#font.pointSize-prop">TextEdit::font.pointSize</a> to set the size of the font in a device independent manner.</p>
</div></div><!-- @@@font.pixelSize -->
<br/>
<!-- $$$font.pointSize -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="font.pointSize-prop">
<td class="tblQmlPropNode"><p>
<a name="font.pointSize-prop"></a><span class="name">font.pointSize</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Sets the font size in points. The point size must be greater than zero.</p>
</div></div><!-- @@@font.pointSize -->
<br/>
<!-- $$$font.preferShaping -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="font.preferShaping-prop">
<td class="tblQmlPropNode"><p>
<a name="font.preferShaping-prop"></a><span class="name">font.preferShaping</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Sometimes, a font will apply complex rules to a set of characters in order to display them correctly. In some writing systems, such as Brahmic scripts, this is required in order for the text to be legible, but in e.g&#x2e; Latin script, it is merely a cosmetic feature. Setting the <code>preferShaping</code> property to false will disable all such features when they are not required, which will improve performance in most cases.</p>
<p>The default value is true.</p>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-textedit.html">TextEdit</a></span> { <span class="name">text</span>: <span class="string">&quot;Some text&quot;</span>; <span class="name">font</span>.preferShaping: <span class="number">false</span> }

</pre>
<p>This property was introduced in  Qt 5.10.</p>
</div></div><!-- @@@font.preferShaping -->
<br/>
<!-- $$$font.strikeout -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="font.strikeout-prop">
<td class="tblQmlPropNode"><p>
<a name="font.strikeout-prop"></a><span class="name">font.strikeout</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Sets whether the font has a strikeout style.</p>
</div></div><!-- @@@font.strikeout -->
<br/>
<!-- $$$font.styleName -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="font.styleName-prop">
<td class="tblQmlPropNode"><p>
<a name="font.styleName-prop"></a><span class="name">font.styleName</span> : <span class="type"><a href="../qtqml/qml-string.html">string</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Sets the style name of the font.</p>
<p>The style name is case insensitive. If set, the font will be matched against style name instead of the font properties <a href="qml-qtquick-textedit.html#font.weight-prop">font.weight</a>, <a href="qml-qtquick-textedit.html#font.bold-prop">font.bold</a> and <a href="qml-qtquick-textedit.html#font.italic-prop">font.italic</a>.</p>
<p>This property was introduced in  Qt 5.6.</p>
</div></div><!-- @@@font.styleName -->
<br/>
<!-- $$$font.underline -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="font.underline-prop">
<td class="tblQmlPropNode"><p>
<a name="font.underline-prop"></a><span class="name">font.underline</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Sets whether the text is underlined.</p>
</div></div><!-- @@@font.underline -->
<br/>
<!-- $$$font.weight -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="font.weight-prop">
<td class="tblQmlPropNode"><p>
<a name="font.weight-prop"></a><span class="name">font.weight</span> : <span class="type"><a href="../qtqml/qml-enumeration.html">enumeration</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Sets the font's weight.</p>
<p>The weight can be one of:</p>
<ul>
<li>Font.Thin</li>
<li>Font.Light</li>
<li>Font.ExtraLight</li>
<li>Font.Normal - the default</li>
<li>Font.Medium</li>
<li>Font.DemiBold</li>
<li>Font.Bold</li>
<li>Font.ExtraBold</li>
<li>Font.Black</li>
</ul>
<pre class="qml">

  <span class="type"><a href="qml-qtquick-textedit.html">TextEdit</a></span> { <span class="name">text</span>: <span class="string">&quot;Hello&quot;</span>; <span class="name">font</span>.weight: <span class="name">Font</span>.<span class="name">DemiBold</span> }

</pre>
</div></div><!-- @@@font.weight -->
<br/>
<!-- $$$font.wordSpacing -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="font.wordSpacing-prop">
<td class="tblQmlPropNode"><p>
<a name="font.wordSpacing-prop"></a><span class="name">font.wordSpacing</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Sets the word spacing for the font.</p>
<p>Word spacing changes the default spacing between individual words. A positive value increases the word spacing by a corresponding amount of pixels, while a negative value decreases the inter-word spacing accordingly.</p>
</div></div><!-- @@@font.wordSpacing -->
<br/>
<!-- $$$horizontalAlignment -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="horizontalAlignment-prop">
<td class="tblQmlPropNode"><p>
<a name="horizontalAlignment-prop"></a><span class="name">horizontalAlignment</span> : <span class="type"><a href="../qtqml/qml-enumeration.html">enumeration</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Sets the horizontal and vertical alignment of the text within the <a href="qml-qtquick-textedit.html">TextEdit</a> item's width and height. By default, the text alignment follows the natural alignment of the text, for example text that is read from left to right will be aligned to the left.</p>
<p>Valid values for <code>horizontalAlignment</code> are:</p>
<ul>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.AlignLeft (default)</li>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.AlignRight</li>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.AlignHCenter</li>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.AlignJustify</li>
</ul>
<p>Valid values for <code>verticalAlignment</code> are:</p>
<ul>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.AlignTop (default)</li>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.AlignBottom</li>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.AlignVCenter</li>
</ul>
<p>When using the attached property <a href="qml-qtquick-layoutmirroring.html#enabled-prop">LayoutMirroring::enabled</a> to mirror application layouts, the horizontal alignment of text will also be mirrored. However, the property <code>horizontalAlignment</code> will remain unchanged. To query the effective horizontal alignment of <a href="qml-qtquick-textedit.html">TextEdit</a>, use the read-only property <code>effectiveHorizontalAlignment</code>.</p>
</div></div><!-- @@@horizontalAlignment -->
<br/>
<!-- $$$hoveredLink -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="hoveredLink-prop">
<td class="tblQmlPropNode"><p>
<a name="hoveredLink-prop"></a><span class="name">hoveredLink</span> : <span class="type"><a href="../qtqml/qml-string.html">string</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property contains the link string when the user hovers a link embedded in the text. The link must be in rich text or HTML format and the link string provides access to the particular link.</p>
<p>This property was introduced in  Qt 5.2.</p>
<p><b>请参考 </b><a href="qml-qtquick-textedit.html#linkHovered-signal">linkHovered</a> 和 <a href="qml-qtquick-textedit.html#linkAt-method">linkAt()</a>。</p>
</div></div><!-- @@@hoveredLink -->
<br/>
<!-- $$$inputMethodComposing -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="inputMethodComposing-prop">
<td class="tblQmlPropNode"><p>
<a name="inputMethodComposing-prop"></a><span class="name">inputMethodComposing</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property holds whether the <a href="qml-qtquick-textedit.html">TextEdit</a> has partial text input from an input method.</p>
<p>While it is composing an input method may rely on mouse or key events from the <a href="qml-qtquick-textedit.html">TextEdit</a> to edit or commit the partial text. This property can be used to determine when to disable events handlers that may interfere with the correct operation of an input method.</p>
</div></div><!-- @@@inputMethodComposing -->
<br/>
<!-- $$$inputMethodHints -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="inputMethodHints-prop">
<td class="tblQmlPropNode"><p>
<a name="inputMethodHints-prop"></a><span class="name">inputMethodHints</span> : <span class="type"><a href="../qtqml/qml-enumeration.html">enumeration</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Provides hints to the input method about the expected content of the text edit and how it should operate.</p>
<p>The value is a bit-wise combination of flags or Qt.ImhNone if no hints are set.</p>
<p>Flags that alter behaviour are:</p>
<ul>
<li>Qt.ImhHiddenText - Characters should be hidden, as is typically used when entering passwords.</li>
<li>Qt.ImhSensitiveData - Typed text should not be stored by the active input method in any persistent storage like predictive user dictionary.</li>
<li>Qt.ImhNoAutoUppercase - The input method should not try to automatically switch to upper case when a sentence ends.</li>
<li>Qt.ImhPreferNumbers - Numbers are preferred (but not required).</li>
<li>Qt.ImhPreferUppercase - Upper case letters are preferred (but not required).</li>
<li>Qt.ImhPreferLowercase - Lower case letters are preferred (but not required).</li>
<li>Qt.ImhNoPredictiveText - Do not use predictive text (i.e&#x2e; dictionary lookup) while typing.</li>
<li>Qt.ImhDate - The text editor functions as a date field.</li>
<li>Qt.ImhTime - The text editor functions as a time field.</li>
</ul>
<p>Flags that restrict input (exclusive flags) are:</p>
<ul>
<li>Qt.ImhDigitsOnly - Only digits are allowed.</li>
<li>Qt.ImhFormattedNumbersOnly - Only number input is allowed. This includes decimal point and minus sign.</li>
<li>Qt.ImhUppercaseOnly - Only upper case letter input is allowed.</li>
<li>Qt.ImhLowercaseOnly - Only lower case letter input is allowed.</li>
<li>Qt.ImhDialableCharactersOnly - Only characters suitable for phone dialing are allowed.</li>
<li>Qt.ImhEmailCharactersOnly - Only characters suitable for email addresses are allowed.</li>
<li>Qt.ImhUrlCharactersOnly - Only characters suitable for URLs are allowed.</li>
</ul>
<p>Masks:</p>
<ul>
<li>Qt.ImhExclusiveInputMask - This mask yields nonzero if any of the exclusive flags are used.</li>
</ul>
</div></div><!-- @@@inputMethodHints -->
<br/>
<!-- $$$leftPadding -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="leftPadding-prop">
<td class="tblQmlPropNode"><p>
<a name="leftPadding-prop"></a><span class="name">leftPadding</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>These properties hold the padding around the content. This space is reserved in addition to the <a href="qml-qtquick-textedit.html#contentWidth-prop">contentWidth</a> and <a href="qml-qtquick-textedit.html#contentHeight-prop">contentHeight</a>.</p>
<p>This property was introduced in  Qt 5.6.</p>
</div></div><!-- @@@leftPadding -->
<br/>
<!-- $$$length -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="length-prop">
<td class="tblQmlPropNode"><p>
<a name="length-prop"></a><span class="name">length</span> : <span class="type"><a href="../qtqml/qml-int.html">int</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Returns the total number of plain text characters in the <a href="qml-qtquick-textedit.html">TextEdit</a> item.</p>
<p>As this number doesn't include any formatting markup it may not be the same as the length of the string returned by the <a href="qml-qtquick-textedit.html#text-prop">text</a> property.</p>
<p>This property can be faster than querying the length the <a href="qml-qtquick-textedit.html#text-prop">text</a> property as it doesn't require any copying or conversion of the <a href="qml-qtquick-textedit.html">TextEdit</a>'s internal string data.</p>
</div></div><!-- @@@length -->
<br/>
<!-- $$$lineCount -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="lineCount-prop">
<td class="tblQmlPropNode"><p>
<a name="lineCount-prop"></a><span class="name">lineCount</span> : <span class="type"><a href="../qtqml/qml-int.html">int</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Returns the total number of lines in the <a href="qml-qtquick-textedit.html">TextEdit</a> item.</p>
</div></div><!-- @@@lineCount -->
<br/>
<!-- $$$mouseSelectionMode -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="mouseSelectionMode-prop">
<td class="tblQmlPropNode"><p>
<a name="mouseSelectionMode-prop"></a><span class="name">mouseSelectionMode</span> : <span class="type"><a href="../qtqml/qml-enumeration.html">enumeration</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Specifies how text should be selected using a mouse.</p>
<ul>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.SelectCharacters - The selection is updated with individual characters. (Default)</li>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.SelectWords - The selection is updated with whole words.</li>
</ul>
<p>This property only applies when <a href="qml-qtquick-textedit.html#selectByMouse-prop">selectByMouse</a> is true.</p>
</div></div><!-- @@@mouseSelectionMode -->
<br/>
<!-- $$$overwriteMode -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="overwriteMode-prop">
<td class="tblQmlPropNode"><p>
<a name="overwriteMode-prop"></a><span class="name">overwriteMode</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Whether text entered by the user will overwrite existing text.</p>
<p>As with many text editors, the text editor widget can be configured to insert or overwrite existing text with new text entered by the user.</p>
<p>If this property is <code>true</code>, existing text is overwritten, character-for-character by new text; otherwise, text is inserted at the cursor position, displacing existing text.</p>
<p>By default, this property is <code>false</code> (new text does not overwrite existing text).</p>
<p>This property was introduced in  Qt 5.8.</p>
</div></div><!-- @@@overwriteMode -->
<br/>
<!-- $$$padding -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="padding-prop">
<td class="tblQmlPropNode"><p>
<a name="padding-prop"></a><span class="name">padding</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>These properties hold the padding around the content. This space is reserved in addition to the <a href="qml-qtquick-textedit.html#contentWidth-prop">contentWidth</a> and <a href="qml-qtquick-textedit.html#contentHeight-prop">contentHeight</a>.</p>
<p>This property was introduced in  Qt 5.6.</p>
</div></div><!-- @@@padding -->
<br/>
<!-- $$$persistentSelection -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="persistentSelection-prop">
<td class="tblQmlPropNode"><p>
<a name="persistentSelection-prop"></a><span class="name">persistentSelection</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Whether the <a href="qml-qtquick-textedit.html">TextEdit</a> should keep the selection visible when it loses active focus to another item in the scene. By default this is set to false.</p>
</div></div><!-- @@@persistentSelection -->
<br/>
<!-- $$$preeditText -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="preeditText-prop">
<td class="tblQmlPropNode"><p>
<a name="preeditText-prop"></a><span class="qmlreadonly">[read-only] </span><span class="name">preeditText</span> : <span class="type"><a href="../qtqml/qml-string.html">string</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This property contains partial text input from an input method.</p>
<p>This property was introduced in  Qt 5.7.</p>
</div></div><!-- @@@preeditText -->
<br/>
<!-- $$$readOnly -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="readOnly-prop">
<td class="tblQmlPropNode"><p>
<a name="readOnly-prop"></a><span class="name">readOnly</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Whether the user can interact with the <a href="qml-qtquick-textedit.html">TextEdit</a> item. If this property is set to true the text cannot be edited by user interaction.</p>
<p>By default this property is false.</p>
</div></div><!-- @@@readOnly -->
<br/>
<!-- $$$renderType -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="renderType-prop">
<td class="tblQmlPropNode"><p>
<a name="renderType-prop"></a><span class="name">renderType</span> : <span class="type"><a href="../qtqml/qml-enumeration.html">enumeration</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Override the default rendering type for this component.</p>
<p>Supported render types are:</p>
<ul>
<li>Text.QtRendering</li>
<li>Text.NativeRendering</li>
</ul>
<p>Select Text.NativeRendering if you prefer text to look native on the target platform and do not require advanced features such as transformation of the text. Using such features in combination with the NativeRendering render type will lend poor and sometimes pixelated results.</p>
<p>The default rendering type is determined by <a href="qquickwindow.html#textRenderType">QQuickWindow::textRenderType()</a>.</p>
</div></div><!-- @@@renderType -->
<br/>
<!-- $$$rightPadding -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="rightPadding-prop">
<td class="tblQmlPropNode"><p>
<a name="rightPadding-prop"></a><span class="name">rightPadding</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>These properties hold the padding around the content. This space is reserved in addition to the <a href="qml-qtquick-textedit.html#contentWidth-prop">contentWidth</a> and <a href="qml-qtquick-textedit.html#contentHeight-prop">contentHeight</a>.</p>
<p>This property was introduced in  Qt 5.6.</p>
</div></div><!-- @@@rightPadding -->
<br/>
<!-- $$$selectByKeyboard -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="selectByKeyboard-prop">
<td class="tblQmlPropNode"><p>
<a name="selectByKeyboard-prop"></a><span class="name">selectByKeyboard</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Defaults to true when the editor is editable, and false when read-only.</p>
<p>If true, the user can use the keyboard to select text even if the editor is read-only. If false, the user cannot use the keyboard to select text even if the editor is editable.</p>
<p>This property was introduced in  Qt 5.1.</p>
<p><b>请参考 </b><a href="qml-qtquick-textedit.html#readOnly-prop">readOnly</a>。</p>
</div></div><!-- @@@selectByKeyboard -->
<br/>
<!-- $$$selectByMouse -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="selectByMouse-prop">
<td class="tblQmlPropNode"><p>
<a name="selectByMouse-prop"></a><span class="name">selectByMouse</span> : <span class="type"><a href="../qtqml/qml-bool.html">bool</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Defaults to false.</p>
<p>If true, the user can use the mouse to select text in some platform-specific way. Note that for some platforms this may not be an appropriate interaction; it may conflict with how the text needs to behave inside a Flickable, for example.</p>
</div></div><!-- @@@selectByMouse -->
<br/>
<!-- $$$selectedText -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="selectedText-prop">
<td class="tblQmlPropNode"><p>
<a name="selectedText-prop"></a><span class="name">selectedText</span> : <span class="type"><a href="../qtqml/qml-string.html">string</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This read-only property provides the text currently selected in the text edit.</p>
<p>It is equivalent to the following snippet, but is faster and easier to use.</p>
<pre class="cpp">

  <span class="comment">//myTextEdit is the id of the TextEdit</span>
  myTextEdit<span class="operator">.</span>text<span class="operator">.</span>toString()<span class="operator">.</span>substring(myTextEdit<span class="operator">.</span>selectionStart<span class="operator">,</span>
          myTextEdit<span class="operator">.</span>selectionEnd);

</pre>
</div></div><!-- @@@selectedText -->
<br/>
<!-- $$$selectedTextColor -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="selectedTextColor-prop">
<td class="tblQmlPropNode"><p>
<a name="selectedTextColor-prop"></a><span class="name">selectedTextColor</span> : <span class="type"><a href="qml-color.html">color</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The selected text color, used in selections.</p>
</div></div><!-- @@@selectedTextColor -->
<br/>
<!-- $$$selectionColor -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="selectionColor-prop">
<td class="tblQmlPropNode"><p>
<a name="selectionColor-prop"></a><span class="name">selectionColor</span> : <span class="type"><a href="qml-color.html">color</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The text highlight color, used behind selections.</p>
</div></div><!-- @@@selectionColor -->
<br/>
<!-- $$$selectionEnd -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="selectionEnd-prop">
<td class="tblQmlPropNode"><p>
<a name="selectionEnd-prop"></a><span class="name">selectionEnd</span> : <span class="type"><a href="../qtqml/qml-int.html">int</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The cursor position after the last character in the current selection.</p>
<p>This property is read-only. To change the selection, use select(start,end), <a href="qml-qtquick-textedit.html#selectAll-method">selectAll()</a>, or <a href="qml-qtquick-textedit.html#selectWord-method">selectWord()</a>.</p>
<p><b>请参考</b> <a href="qml-qtquick-textedit.html#selectionStart-prop">selectionStart</a>，<a href="qml-qtquick-textedit.html#cursorPosition-prop">cursorPosition</a> 和 <a href="qml-qtquick-textedit.html#selectedText-prop">selectedText</a>。</p>
</div></div><!-- @@@selectionEnd -->
<br/>
<!-- $$$selectionStart -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="selectionStart-prop">
<td class="tblQmlPropNode"><p>
<a name="selectionStart-prop"></a><span class="name">selectionStart</span> : <span class="type"><a href="../qtqml/qml-int.html">int</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The cursor position before the first character in the current selection.</p>
<p>This property is read-only. To change the selection, use select(start,end), <a href="qml-qtquick-textedit.html#selectAll-method">selectAll()</a>, or <a href="qml-qtquick-textedit.html#selectWord-method">selectWord()</a>.</p>
<p><b>请参考</b> <a href="qml-qtquick-textedit.html#selectionEnd-prop">selectionEnd</a>，<a href="qml-qtquick-textedit.html#cursorPosition-prop">cursorPosition</a> 和 <a href="qml-qtquick-textedit.html#selectedText-prop">selectedText</a>。</p>
</div></div><!-- @@@selectionStart -->
<br/>
<!-- $$$tabStopDistance -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="tabStopDistance-prop">
<td class="tblQmlPropNode"><p>
<a name="tabStopDistance-prop"></a><span class="name">tabStopDistance</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The default distance, in device units, between tab stops.</p>
<p>This property was introduced in  Qt 5.10.</p>
<p><b>请参考 </b><a href="../qtgui/qtextoption-obsolete.html#setTabStop">QTextOption::setTabStop()</a>。</p>
</div></div><!-- @@@tabStopDistance -->
<br/>
<!-- $$$text -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="text-prop">
<td class="tblQmlPropNode"><p>
<a name="text-prop"></a><span class="name">text</span> : <span class="type"><a href="../qtqml/qml-string.html">string</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The text to display. If the text format is AutoText the text edit will automatically determine whether the text should be treated as rich text. This determination is made using <a href="../qtgui/qt-sub-qtgui.html#mightBeRichText">Qt::mightBeRichText()</a>.</p>
<p>The text-property is mostly suitable for setting the initial content and handling modifications to relatively small text content. The <a href="qml-qtquick-textedit.html#append-method">append()</a>, <a href="qml-qtquick-textedit.html#insert-method">insert()</a> and <a href="qml-qtquick-textedit.html#remove-method">remove()</a> methods provide more fine-grained control and remarkably better performance for modifying especially large rich text content.</p>
<p><b>请参考 </b><a href="qml-qtquick-textedit.html#clear-method">clear()</a>。</p>
</div></div><!-- @@@text -->
<br/>
<!-- $$$textDocument -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="textDocument-prop">
<td class="tblQmlPropNode"><p>
<a name="textDocument-prop"></a><span class="name">textDocument</span> : <span class="type">TextDocument</span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Returns the <a href="qquicktextdocument.html">QQuickTextDocument</a> of this <a href="qml-qtquick-textedit.html">TextEdit</a>. It can be used to implement syntax highlighting using <a href="../qtgui/qsyntaxhighlighter.html">QSyntaxHighlighter</a>.</p>
<p>This property was introduced in  Qt 5.1.</p>
<p><b>请参考 </b><a href="qquicktextdocument.html">QQuickTextDocument</a>。</p>
</div></div><!-- @@@textDocument -->
<br/>
<!-- $$$textFormat -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="textFormat-prop">
<td class="tblQmlPropNode"><p>
<a name="textFormat-prop"></a><span class="name">textFormat</span> : <span class="type"><a href="../qtqml/qml-enumeration.html">enumeration</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The way the text property should be displayed.</p>
<ul>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.AutoText</li>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.PlainText</li>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.RichText</li>
</ul>
<p>The default is <a href="qml-qtquick-textedit.html">TextEdit</a>.PlainText. If the text format is <a href="qml-qtquick-textedit.html">TextEdit</a>.AutoText the text edit will automatically determine whether the text should be treated as rich text. This determination is made using <a href="../qtgui/qt-sub-qtgui.html#mightBeRichText">Qt::mightBeRichText()</a>.</p>
<div class="table"><table class="generic">
 <tr valign="top" class="odd"><td ><pre class="qml">

  <span class="type"><a href="qml-qtquick-column.html">Column</a></span> {
      <span class="type"><a href="qml-qtquick-textedit.html">TextEdit</a></span> {
          <span class="name">font</span>.pointSize: <span class="number">24</span>
          <span class="name">text</span>: <span class="string">&quot;&lt;b&gt;Hello&lt;/b&gt; &lt;i&gt;World!&lt;/i&gt;&quot;</span>
      }
      <span class="type"><a href="qml-qtquick-textedit.html">TextEdit</a></span> {
          <span class="name">font</span>.pointSize: <span class="number">24</span>
          <span class="name">textFormat</span>: <span class="name">TextEdit</span>.<span class="name">RichText</span>
          <span class="name">text</span>: <span class="string">&quot;&lt;b&gt;Hello&lt;/b&gt; &lt;i&gt;World!&lt;/i&gt;&quot;</span>
      }
      <span class="type"><a href="qml-qtquick-textedit.html">TextEdit</a></span> {
          <span class="name">font</span>.pointSize: <span class="number">24</span>
          <span class="name">textFormat</span>: <span class="name">TextEdit</span>.<span class="name">PlainText</span>
          <span class="name">text</span>: <span class="string">&quot;&lt;b&gt;Hello&lt;/b&gt; &lt;i&gt;World!&lt;/i&gt;&quot;</span>
      }
  }

</pre>
</td><td ><p class="centerAlign"><img src="images/declarative-textformat.png" alt="" /></p></td></tr>
</table></div>
</div></div><!-- @@@textFormat -->
<br/>
<!-- $$$textMargin -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="textMargin-prop">
<td class="tblQmlPropNode"><p>
<a name="textMargin-prop"></a><span class="name">textMargin</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>The margin, in pixels, around the text in the <a href="qml-qtquick-textedit.html">TextEdit</a>.</p>
</div></div><!-- @@@textMargin -->
<br/>
<!-- $$$topPadding -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="topPadding-prop">
<td class="tblQmlPropNode"><p>
<a name="topPadding-prop"></a><span class="name">topPadding</span> : <span class="type"><a href="../qtqml/qml-real.html">real</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>These properties hold the padding around the content. This space is reserved in addition to the <a href="qml-qtquick-textedit.html#contentWidth-prop">contentWidth</a> and <a href="qml-qtquick-textedit.html#contentHeight-prop">contentHeight</a>.</p>
<p>This property was introduced in  Qt 5.6.</p>
</div></div><!-- @@@topPadding -->
<br/>
<!-- $$$verticalAlignment -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="verticalAlignment-prop">
<td class="tblQmlPropNode"><p>
<a name="verticalAlignment-prop"></a><span class="name">verticalAlignment</span> : <span class="type"><a href="../qtqml/qml-enumeration.html">enumeration</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Sets the horizontal and vertical alignment of the text within the <a href="qml-qtquick-textedit.html">TextEdit</a> item's width and height. By default, the text alignment follows the natural alignment of the text, for example text that is read from left to right will be aligned to the left.</p>
<p>Valid values for <code>horizontalAlignment</code> are:</p>
<ul>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.AlignLeft (default)</li>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.AlignRight</li>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.AlignHCenter</li>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.AlignJustify</li>
</ul>
<p>Valid values for <code>verticalAlignment</code> are:</p>
<ul>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.AlignTop (default)</li>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.AlignBottom</li>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.AlignVCenter</li>
</ul>
<p>When using the attached property <a href="qml-qtquick-layoutmirroring.html#enabled-prop">LayoutMirroring::enabled</a> to mirror application layouts, the horizontal alignment of text will also be mirrored. However, the property <code>horizontalAlignment</code> will remain unchanged. To query the effective horizontal alignment of <a href="qml-qtquick-textedit.html">TextEdit</a>, use the read-only property <code>effectiveHorizontalAlignment</code>.</p>
</div></div><!-- @@@verticalAlignment -->
<br/>
<!-- $$$wrapMode -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="wrapMode-prop">
<td class="tblQmlPropNode"><p>
<a name="wrapMode-prop"></a><span class="name">wrapMode</span> : <span class="type"><a href="../qtqml/qml-enumeration.html">enumeration</a></span></p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Set this property to wrap the text to the <a href="qml-qtquick-textedit.html">TextEdit</a> item's width. The text will only wrap if an explicit width has been set.</p>
<ul>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.NoWrap - no wrapping will be performed. If the text contains insufficient newlines, then implicitWidth will exceed a set width.</li>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.WordWrap - wrapping is done on word boundaries only. If a word is too long, implicitWidth will exceed a set width.</li>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.WrapAnywhere - wrapping is done at any point on a line, even if it occurs in the middle of a word.</li>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.Wrap - if possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word.</li>
</ul>
<p>The default is <a href="qml-qtquick-textedit.html">TextEdit</a>.NoWrap. If you set a width, consider using <a href="qml-qtquick-textedit.html">TextEdit</a>.Wrap.</p>
</div></div><!-- @@@wrapMode -->
<br/>
<h2>Signal Documentation</h2>
<!-- $$$editingFinished -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="editingFinished-signal">
<td class="tblQmlFuncNode"><p>
<a name="editingFinished-signal"></a><span class="name">editingFinished</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This signal is emitted when the text edit loses focus.</p>
<p>The corresponding handler is <code>onEditingFinished</code>.</p>
<p>This signal was introduced in  Qt 5.6.</p>
</div></div><!-- @@@editingFinished -->
<br/>
<!-- $$$linkActivated -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="linkActivated-signal">
<td class="tblQmlFuncNode"><p>
<a name="linkActivated-signal"></a><span class="name">linkActivated</span>(<span class="type"><a href="../qtqml/qml-string.html">string</a></span> <i>link</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This signal is emitted when the user clicks on a link embedded in the text. The link must be in rich text or HTML format and the <i>link</i> string provides access to the particular link.</p>
<p>The corresponding handler is <code>onLinkActivated</code>.</p>
</div></div><!-- @@@linkActivated -->
<br/>
<!-- $$$linkHovered -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="linkHovered-signal">
<td class="tblQmlFuncNode"><p>
<a name="linkHovered-signal"></a><span class="name">linkHovered</span>(<span class="type"><a href="../qtqml/qml-string.html">string</a></span> <i>link</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>This signal is emitted when the user hovers a link embedded in the text. The link must be in rich text or HTML format and the <i>link</i> string provides access to the particular link.</p>
<p>The corresponding handler is <code>onLinkHovered</code>.</p>
<p>This signal was introduced in  Qt 5.2.</p>
<p><b>请参考 </b><a href="qml-qtquick-textedit.html#hoveredLink-prop">hoveredLink</a> 和 <a href="qml-qtquick-textedit.html#linkAt-method">linkAt()</a>。</p>
</div></div><!-- @@@linkHovered -->
<br/>
<h2>Method Documentation</h2>
<!-- $$$append -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="append-method">
<td class="tblQmlFuncNode"><p>
<a name="append-method"></a><span class="type">void</span> <span class="name">append</span>(<span class="type"><a href="../qtqml/qml-string.html">string</a></span> <i>text</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Appends a new paragraph with <i>text</i> to the end of the <a href="qml-qtquick-textedit.html">TextEdit</a>.</p>
<p>In order to append without inserting a new paragraph, call <code>myTextEdit.insert(myTextEdit.length, text)</code> instead.</p>
<p>This method was introduced in  Qt 5.2.</p>
</div></div><!-- @@@append -->
<br/>
<!-- $$$clear -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="clear-method">
<td class="tblQmlFuncNode"><p>
<a name="clear-method"></a><span class="name">clear</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Clears the contents of the text edit and resets partial text input from an input method.</p>
<p>Use this method instead of setting the <a href="qml-qtquick-textedit.html#text-prop">text</a> property to an empty string.</p>
<p>This method was introduced in  Qt 5.7.</p>
<p><b>请参考 </b><a href="../qtgui/qinputmethod.html#reset">QInputMethod::reset()</a>。</p>
</div></div><!-- @@@clear -->
<br/>
<!-- $$$copy -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="copy-method">
<td class="tblQmlFuncNode"><p>
<a name="copy-method"></a><span class="name">copy</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Copies the currently selected text to the system clipboard.</p>
</div></div><!-- @@@copy -->
<br/>
<!-- $$$cut -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="cut-method">
<td class="tblQmlFuncNode"><p>
<a name="cut-method"></a><span class="name">cut</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Moves the currently selected text to the system clipboard.</p>
</div></div><!-- @@@cut -->
<br/>
<!-- $$$deselect -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="deselect-method">
<td class="tblQmlFuncNode"><p>
<a name="deselect-method"></a><span class="name">deselect</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Removes active text selection.</p>
</div></div><!-- @@@deselect -->
<br/>
<!-- $$$getFormattedText -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="getFormattedText-method">
<td class="tblQmlFuncNode"><p>
<a name="getFormattedText-method"></a><span class="type"><a href="../qtqml/qml-string.html">string</a></span> <span class="name">getFormattedText</span>(<span class="type"><a href="../qtqml/qml-int.html">int</a></span> <i>start</i>,  <span class="type"><a href="../qtqml/qml-int.html">int</a></span> <i>end</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Returns the section of text that is between the <i>start</i> and <i>end</i> positions.</p>
<p>The returned text will be formatted according the <a href="qml-qtquick-textedit.html#textFormat-prop">textFormat</a> property.</p>
</div></div><!-- @@@getFormattedText -->
<br/>
<!-- $$$getText -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="getText-method">
<td class="tblQmlFuncNode"><p>
<a name="getText-method"></a><span class="type"><a href="../qtqml/qml-string.html">string</a></span> <span class="name">getText</span>(<span class="type"><a href="../qtqml/qml-int.html">int</a></span> <i>start</i>,  <span class="type"><a href="../qtqml/qml-int.html">int</a></span> <i>end</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Returns the section of text that is between the <i>start</i> and <i>end</i> positions.</p>
<p>The returned text does not include any rich text formatting.</p>
</div></div><!-- @@@getText -->
<br/>
<!-- $$$insert -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="insert-method">
<td class="tblQmlFuncNode"><p>
<a name="insert-method"></a><span class="name">insert</span>(<span class="type"><a href="../qtqml/qml-int.html">int</a></span> <i>position</i>,  <span class="type"><a href="../qtqml/qml-string.html">string</a></span> <i>text</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Inserts <i>text</i> into the <a href="qml-qtquick-textedit.html">TextEdit</a> at position.</p>
</div></div><!-- @@@insert -->
<br/>
<!-- $$$isRightToLeft -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="isRightToLeft-method">
<td class="tblQmlFuncNode"><p>
<a name="isRightToLeft-method"></a><span class="name">isRightToLeft</span>(<span class="type"><a href="../qtqml/qml-int.html">int</a></span> <i>start</i>,  <span class="type"><a href="../qtqml/qml-int.html">int</a></span> <i>end</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Returns true if the natural reading direction of the editor text found between positions <i>start</i> and <i>end</i> is right to left.</p>
</div></div><!-- @@@isRightToLeft -->
<br/>
<!-- $$$linkAt -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="linkAt-method">
<td class="tblQmlFuncNode"><p>
<a name="linkAt-method"></a><span class="name">linkAt</span>(<span class="type"><a href="../qtqml/qml-real.html">real</a></span> <i>x</i>,  <span class="type"><a href="../qtqml/qml-real.html">real</a></span> <i>y</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Returns the link string at point <i>x</i>, <i>y</i> in content coordinates, or an empty string if no link exists at that point.</p>
<p>This method was introduced in  Qt 5.3.</p>
<p><b>请参考 </b><a href="qml-qtquick-textedit.html#hoveredLink-prop">hoveredLink</a>。</p>
</div></div><!-- @@@linkAt -->
<br/>
<!-- $$$moveCursorSelection -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="moveCursorSelection-method">
<td class="tblQmlFuncNode"><p>
<a name="moveCursorSelection-method"></a><span class="name">moveCursorSelection</span>(<span class="type"><a href="../qtqml/qml-int.html">int</a></span> <i>position</i>,  <span class="type">SelectionMode</span> <span class="type">mode</span> = <i>TextEdit.SelectCharacters</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Moves the cursor to <i>position</i> and updates the selection according to the optional <i>mode</i> parameter. (To only move the cursor, set the <a href="qml-qtquick-textedit.html#cursorPosition-prop">cursorPosition</a> property.)</p>
<p>When this method is called it additionally sets either the <a href="qml-qtquick-textedit.html#selectionStart-prop">selectionStart</a> or the <a href="qml-qtquick-textedit.html#selectionEnd-prop">selectionEnd</a> (whichever was at the previous cursor position) to the specified position. This allows you to easily extend and contract the selected text range.</p>
<p>The selection mode specifies whether the selection is updated on a per character or a per word basis. If not specified the selection mode will default to <a href="qml-qtquick-textedit.html">TextEdit</a>.SelectCharacters.</p>
<ul>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.SelectCharacters - Sets either the <a href="qml-qtquick-textedit.html#selectionStart-prop">selectionStart</a> or <a href="qml-qtquick-textedit.html#selectionEnd-prop">selectionEnd</a> (whichever was at the previous cursor position) to the specified position.</li>
<li><a href="qml-qtquick-textedit.html">TextEdit</a>.SelectWords - Sets the <a href="qml-qtquick-textedit.html#selectionStart-prop">selectionStart</a> and <a href="qml-qtquick-textedit.html#selectionEnd-prop">selectionEnd</a> to include all words between the specified position and the previous cursor position. Words partially in the range are included.</li>
</ul>
<p>For example, take this sequence of calls:</p>
<pre class="cpp">

  cursorPosition <span class="operator">=</span> <span class="number">5</span>
  moveCursorSelection(<span class="number">9</span><span class="operator">,</span> TextEdit<span class="operator">.</span>SelectCharacters)
  moveCursorSelection(<span class="number">7</span><span class="operator">,</span> TextEdit<span class="operator">.</span>SelectCharacters)

</pre>
<p>This moves the cursor to position 5, extend the selection end from 5 to 9 and then retract the selection end from 9 to 7, leaving the text from position 5 to 7 selected (the 6th and 7th characters).</p>
<p>The same sequence with <a href="qml-qtquick-textedit.html">TextEdit</a>.SelectWords will extend the selection start to a word boundary before or on position 5 and extend the selection end to a word boundary on or past position 9.</p>
</div></div><!-- @@@moveCursorSelection -->
<br/>
<!-- $$$paste -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="paste-method">
<td class="tblQmlFuncNode"><p>
<a name="paste-method"></a><span class="name">paste</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Replaces the currently selected text by the contents of the system clipboard.</p>
</div></div><!-- @@@paste -->
<br/>
<!-- $$$positionAt -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="positionAt-method">
<td class="tblQmlFuncNode"><p>
<a name="positionAt-method"></a><span class="type"><a href="../qtqml/qml-int.html">int</a></span> <span class="name">positionAt</span>(<span class="type"><a href="../qtqml/qml-int.html">int</a></span> <i>x</i>,  <span class="type"><a href="../qtqml/qml-int.html">int</a></span> <i>y</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Returns the text position closest to pixel position (<i>x</i>, <i>y</i>).</p>
<p>Position 0 is before the first character, position 1 is after the first character but before the second, and so on until position <a href="qml-qtquick-textedit.html#text-prop">text</a>.length, which is after all characters.</p>
</div></div><!-- @@@positionAt -->
<br/>
<!-- $$$positionToRectangle -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="positionToRectangle-method">
<td class="tblQmlFuncNode"><p>
<a name="positionToRectangle-method"></a><span class="type">rectangle</span> <span class="name">positionToRectangle</span>(<i>position</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Returns the rectangle at the given <i>position</i> in the text. The x, y, and height properties correspond to the cursor that would describe that position.</p>
</div></div><!-- @@@positionToRectangle -->
<br/>
<!-- $$$redo -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="redo-method">
<td class="tblQmlFuncNode"><p>
<a name="redo-method"></a><span class="name">redo</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Redoes the last operation if redo is <a href="qml-qtquick-textedit.html#canRedo-prop">available</a>.</p>
</div></div><!-- @@@redo -->
<br/>
<!-- $$$remove -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="remove-method">
<td class="tblQmlFuncNode"><p>
<a name="remove-method"></a><span class="type"><a href="../qtqml/qml-string.html">string</a></span> <span class="name">remove</span>(<span class="type"><a href="../qtqml/qml-int.html">int</a></span> <i>start</i>,  <span class="type"><a href="../qtqml/qml-int.html">int</a></span> <i>end</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Removes the section of text that is between the <i>start</i> and <i>end</i> positions from the <a href="qml-qtquick-textedit.html">TextEdit</a>.</p>
</div></div><!-- @@@remove -->
<br/>
<!-- $$$select -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="select-method">
<td class="tblQmlFuncNode"><p>
<a name="select-method"></a><span class="name">select</span>(<span class="type"><a href="../qtqml/qml-int.html">int</a></span> <i>start</i>,  <span class="type"><a href="../qtqml/qml-int.html">int</a></span> <i>end</i>)</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Causes the text from <i>start</i> to <i>end</i> to be selected.</p>
<p>If either start or end is out of range, the selection is not changed.</p>
<p>After calling this, <a href="qml-qtquick-textedit.html#selectionStart-prop">selectionStart</a> will become the lesser and <a href="qml-qtquick-textedit.html#selectionEnd-prop">selectionEnd</a> will become the greater (regardless of the order passed to this method).</p>
<p><b>请参考 </b><a href="qml-qtquick-textedit.html#selectionStart-prop">selectionStart</a> 和 <a href="qml-qtquick-textedit.html#selectionEnd-prop">selectionEnd</a>。</p>
</div></div><!-- @@@select -->
<br/>
<!-- $$$selectAll -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="selectAll-method">
<td class="tblQmlFuncNode"><p>
<a name="selectAll-method"></a><span class="name">selectAll</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Causes all text to be selected.</p>
</div></div><!-- @@@selectAll -->
<br/>
<!-- $$$selectWord -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="selectWord-method">
<td class="tblQmlFuncNode"><p>
<a name="selectWord-method"></a><span class="name">selectWord</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Causes the word closest to the current cursor position to be selected.</p>
</div></div><!-- @@@selectWord -->
<br/>
<!-- $$$undo -->
<div class="qmlitem"><div class="qmlproto">
<div class="table"><table class="qmlname">
<tr valign="top" class="odd" id="undo-method">
<td class="tblQmlFuncNode"><p>
<a name="undo-method"></a><span class="name">undo</span>()</p></td></tr>
</table></div>
</div><div class="qmldoc"><p>Undoes the last operation if undo is <a href="qml-qtquick-textedit.html#canUndo-prop">available</a>. Deselects any current selection, and updates the selection start to the current cursor position.</p>
</div></div><!-- @@@undo -->
<br/>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2019 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
